package edu.kit.aifb.ldsbench.generator.opt2;

import edu.kit.aifb.ldsbench.cli2.CLI;

public class OptProblemInstance {

	public static final byte CONSTRAINT_WITH_UPPER_BOUND = 1;
	public static final byte CONSTRAINT_WITH_EQUALITY = 2;
	public static final byte CONSTRAINT_WITH_LOWER_BOUND = 3;
	public static final byte CONSTRAINT_WITH_BOTH_BOUNDS = 4;
	
	// constants
	private double[] a;
	private int aDim;
	private byte[] ctype;
	
	// objective function
	private double[] c;
	// constraints bounds
	private double[] b;
	// lower bound
	private double[] lb;
	// upper bound
	private double[] ub;
	
	// true if minimization
	private boolean minimize;

	public OptProblemInstance(double[] a, byte[] ctype, int aDim, double[] c, double[] b,
			double[] lb, double[] ub, boolean minimize) {
		if(a == null || c == null || b == null || lb == null || ub == null || aDim == 0){
			throw new IllegalArgumentException("At least one parameter was null.");
		}
		if(a.length % aDim != 0 || b.length != a.length / aDim){
			throw new IllegalArgumentException("Wrong dimension of parameters.");
		}
		this.a = a;
		this.aDim = aDim;
		this.ctype = ctype;
		this.c = c;
		this.b = b;
		this.lb = lb;
		this.ub = ub;
		this.minimize = minimize;
	}

	public String toString(){
		StringBuilder s = new StringBuilder("Lengt of a: ");
		s.append(a.length);
		s.append("\n dimA: ");
		s.append(this.aDim);
		s.append(" equal? \n cLength: ");
		s.append(this.c.length);
		s.append(" \n blength: ");
		s.append(b.length);
		s.append(" \n lbLength: ");
		s.append(lb.length);
		s.append(" \n ubLength: ");
		s.append(ub.length);
		s.append(" \n minimization: ");
		s.append(this.minimize);
		return s.toString();
	}
	

	/**
	 * @return the a
	 */
	public double[] getA() {
		return a;
	}

	/**
	 * @return the aDim
	 */
	public int getaDim() {
		return aDim;
	}

	/**
	 * @return the c
	 */
	public double[] getC() {
		return c;
	}

	/**
	 * @return the b
	 */
	public double[] getB() {
		return b;
	}

	/**
	 * @return the lb
	 */
	public double[] getLb() {
		return lb;
	}

	/**
	 * @return the ub
	 */
	public double[] getUb() {
		return ub;
	}

	/**
	 * @return the minimize
	 */
	public boolean isMinimize() {
		return minimize;
	}

	/**
	 * @return the ctype
	 */
	public byte[] getCtype() {
		return ctype;
	}
	
	
}
